
from ceres import optimize
from ceres import optimize_ceres
import numpy as np

def func(ps):
    print "heelo"
    print ps
    return np.sum(ps**2)

def grad(ps):
    return 2 * ps

x0 = np.array([1,2,3,4,5,6,7,8,9,10], dtype=np.double)

print(optimize(func, grad, x0))


RR = np.array([1,2,3], dtype=np.double)
tt = np.array([1,2,3], dtype=np.double)
obj_pts_in_world=np.array([5,4,3,4,5,6], dtype=np.double).reshape(2,3)
uv_pts_in_world=np.array([5,4,3,4], dtype=np.double).reshape(2,2)
print(obj_pts_in_world.shape[0])
print(optimize_ceres(func,RR,tt,obj_pts_in_world,uv_pts_in_world,obj_pts_in_world.shape[0]))
